//
//  BCLetterPopViewController.m
//  aiteshangcheng
//
//  Created by mac on 2017/6/8.
//  Copyright © 2017年 aite. All rights reserved.
//

#import "BCLetterPopViewController.h"
#import "Utility.h"

@interface BCLetterPopViewController ()

@end

@implementation BCLetterPopViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.view.backgroundColor = COLOR(255, 226, 227, 1);
    NSArray *imageArray = @[@"7-1_03",@"7-1_06",@"7-1_03",@"7-1_08"];
    NSArray *titleArray = @[@"收到的站内信",@"系统消息",@"私信",@"我要发送站内信"];
    for (int i = 0; i < titleArray.count; i ++) {
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0, 30 * i + 5, 170, 30)];
        button.backgroundColor = [UIColor clearColor];
        [button setImage:[UIImage imageNamed:imageArray[i]] forState:UIControlStateNormal];
        button.tag = 10000 + i;
        [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        button.titleLabel.font = FONT(15);
        button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        [button  setTitle:titleArray[i] forState:UIControlStateNormal];
        [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button];
        
    }
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.preferredContentSize = CGSizeMake(170, 130);
}

- (void)buttonClicked:(UIButton *)button{
    switch (button.tag) {
        case 10000:
            [self.delegate haveGettedLetter:button];
            break;
        case 10001:
            [self.delegate haveSendLetter:button];
            break;
        case 10002:
            [self.delegate letter:button];
            break;
        case 10003:
            [self.delegate sendLetter:button];
            break;

        default:
            break;
    }
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
